package com.example.demo.config;

import com.example.demo.controller.LogController;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-05-31
 * Time: 11:39
 */
@Aspect
@Component
public class LogAOP {

    // 创建切点
    @Pointcut("execution(* com.example.demo.controller.LogController.* (..))")
    public void doPointcut() {
        // 切点只是为了配置规则, 并非具体实现. 因此为空方法
    }

    // 创建后置通知
    @After("doPointcut()")
    public void doAfter() {
        System.out.println("记录日志结束 ");
    }
}
